package org.framework.lazy.cloud.network.heartbeat.server.standalone.infrastructure.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.wu.framework.lazy.orm.core.stereotype.*;

import java.time.LocalDateTime;

/**
 * describe 服务端虚拟路由管理
 *
 * @author Jia wei Wu
 * @date 2025/05/06 05:00 下午
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureEntity
 **/
@Data
@Accessors(chain = true)
@LazyTable(tableName = "lazy_netty_server_virtual_route", comment = "服务端虚拟路由管理")
@Schema(title = "lazy_netty_server_virtual_route", description = "服务端虚拟路由管理")
public class LazyNettyServerVirtualRouteDO {


    /**
     * 创建时间
     */
    @Schema(description = "创建时间", name = "createTime", example = "")
    @LazyTableField(name = "create_time", comment = "创建时间", defaultValue = "CURRENT_TIMESTAMP", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "datetime", extra = " on update CURRENT_TIMESTAMP")
    private LocalDateTime createTime;

    /**
     * 规则描述
     */
    @Schema(description = "规则描述", name = "describe", example = "")
    @LazyTableField(name = "describe", comment = "规则描述", columnType = "varchar(255)")
    private String describe;

    /**
     * 主键ID
     */
    @Schema(description = "主键ID", name = "id", example = "")
    @LazyTableFieldId(name = "id", comment = "主键ID")
    private Long id;


    /**
     * 是否删除
     */
    @Schema(description = "是否删除", name = "isDeleted", example = "")
    @LazyTableField(name = "is_deleted", comment = "是否删除", notNull = true, defaultValue = "'0'", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "tinyint(1)")
    private Boolean isDeleted;

    /**
     * 目标路由IP
     */
    @Schema(description = "目标路由IP", name = "targetIp", example = "")
    @LazyTableField(name = "target_ip", comment = "目标路由IP", notNull = true, columnType = "varchar(255)")
    private String targetIp;

    /**
     * 目标路由端口：默认ALL
     */
    @Schema(description = "目标路由端口：默认ALL", name = "targetPort", example = "")
    @LazyTableField(name = "target_port", comment = "目标路由端口：默认ALL", notNull = true, defaultValue = "'*'", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "varchar(255)")
    private String targetPort;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间", name = "updateTime", example = "")
    @LazyTableField(name = "update_time", comment = "更新时间", defaultValue = "CURRENT_TIMESTAMP", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "datetime", extra = " on update CURRENT_TIMESTAMP")
    private LocalDateTime updateTime;

    /**
     * 虚拟服务端路由IP
     */
    @Schema(description = "虚拟服务端路由IP", name = "virtualIp", example = "")
    @LazyTableFieldUnique(name = "virtual_ip", comment = "虚拟服务端路由IP", notNull = true, columnType = "varchar(255)")
    private String virtualIp;

    /**
     * 虚拟服务端路由端口：默认ALL
     */
    @Schema(description = "虚拟服务端路由端口：默认ALL", name = "virtualPort", example = "")
    @LazyTableFieldUnique(name = "virtual_port", comment = "虚拟服务端路由端口：默认ALL", notNull = true, defaultValue = "'*'", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "varchar(255)")
    private String virtualPort;

}